package p13.p1315;

public class MaoPaoPaiXu {
    public static void main(String[] args) {
        int[] aee = {24, 69, 80, 57, 13,12,43,65,76,33};
        System.out.println("遍历:");
        printArrey(aee);
        System.out.println();
        System.out.println("排序:");
        paixu(aee);
        printArrey(aee);

//        text1(aee);
//        System.out.println("---");
//        text2(aee);
    }

    //遍历
    public static void printArrey(int arr[]) {
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]);
            System.out.printf(" ");
        }
    }

    //排序
    public static void paixu(int aee[]) {
        for (int a = 0;a<aee.length-1;a++) {
            for (int i = 0; i < aee.length - 1; i++) {
                if (aee[i] > aee[i + 1]) {
                    int temp = aee[i];
                    aee[i] = aee[i + 1];
                    aee[i + 1] = temp;
                    //*System.out.println(aee[i]);*//*
                }
            }
        }
    }

    //text1
    public static void text1(int arr[]) {
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]);
            System.out.printf(" ");
        }
    }
    //text2
    public static void text2(int arr[]) {
        for (int i = 0; i <=arr.length-1; i++) {
            System.out.print(arr[i]);
            System.out.printf(" ");
        }
    }
}